package com.fz.us.oa.core.entity.com;

import com.fz.us.admin.company.entity.BaseFlowEntity;
import com.fz.us.admin.company.entity.User;
import org.hibernate.annotations.Type;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

/**
 * Created by ZhuChunXiao on 2017/7/11.
 * 聊天记录
 */
@Entity
@Table(name="sys_chatlog")
public class ChatLog extends BaseFlowEntity {
    private static final long serialVersionUID = -1456514077452761147L;

    /**
     * 发送者
     */
    private User sender;
    /**
     * 接受者
     */
//    private User receiver;
    private String receiverId;
    /**
     * 聊天类型 1文本信息 4图片信息 7附件信息
     */
    private String chatType;
    /**
     * 文本聊天内容
     */
    private String content;
    /**
     * 文件名
     */
    private String fileName;
    /**
     * 文件或图片的地址
     */
    private String fileAddress;
    /**
     * 文件大小
     */
    private String fileSize;
    /**
     * 聊天id
     */
    private String msgId;

    @ManyToOne(fetch = FetchType.LAZY)
    public User getSender() {
        return sender;
    }

    public void setSender(User sender) {
        this.sender = sender;
    }

//    @ManyToOne(fetch = FetchType.LAZY)
//    public User getReceiver() {
//        return receiver;
//    }
//
//    public void setReceiver(User receiver) {
//        this.receiver = receiver;
//    }


    public String getReceiverId() {
        return receiverId;
    }

    public void setReceiverId(String receiverId) {
        this.receiverId = receiverId;
    }

    @Type(type="text")
    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getChatType() {
        return chatType;
    }

    public void setChatType(String chatType) {
        this.chatType = chatType;
    }

    @Type(type="text")
    public String getFileAddress() {
        return fileAddress;
    }

    public void setFileAddress(String fileAddress) {
        this.fileAddress = fileAddress;
    }

    public String getFileSize() {
        return fileSize;
    }

    public void setFileSize(String fileSize) {
        this.fileSize = fileSize;
    }

    public String getFileName() {
        return fileName;
    }

    public void setFileName(String fileName) {
        this.fileName = fileName;
    }

    public String getMsgId() {
        return msgId;
    }

    public void setMsgId(String msgId) {
        this.msgId = msgId;
    }
}
